#ifndef HISTORYWIDGET_H
#define HISTORYWIDGET_H

#include <QListWidget>
#include <QWidget>
#include "historyrecord.h"
#include <QDebug>

namespace Ui {
class HistoryWidget;
}

class HistoryWidget : public QWidget
{
    Q_OBJECT

public:
    explicit HistoryWidget(QWidget *parent = nullptr);
    ~HistoryWidget();
    void showEvent(QShowEvent *event) override;
    void updateHistoryData(QDateTime startTime);
    void reloadHistoryData();

    static bool caseInsensitiveLessThan(const HistoryRecord &s1, const HistoryRecord &s2);
private slots:
    void handleItemClick(QListWidgetItem *item);
    void handleItemDoubleClick(QListWidgetItem *item);

signals:
    void loadUrl(QString url);

private:
    Ui::HistoryWidget *ui;
    QVector<HistoryRecord> m_historyRecord;
};

#endif // HISTORYWIDGET_H
